﻿<phone:PhoneApplicationPage 
    x:Class="ChiantiPhoneListApp.PanoramaPage1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    xmlns:m="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

   
    <!--LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot">
        <controls:Pivot x:Name="p_Pivot"  Title="MyTown Deals" FontSize="36" >

            <!--Panorama item one-->
            <controls:PivotItem Header="current" >
                <Grid>
                    <Rectangle x:Name="rec_Expired" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="Black"/>
                    <StackPanel x:Name="sp_MainLayout">                      
                        <TextBlock x:Name="tb_ActiveDealMsg" Visibility="Collapsed" Style="{StaticResource PhoneTextNormalStyle}"/>
                        <StackPanel x:Name="sp_ActiveDeal">
                                <TextBlock Text="{Binding Title, Mode=TwoWay}" Style="{StaticResource PhoneTextLargeStyle}"/>
                                <TextBlock Text="{Binding Description, Mode=TwoWay}" TextWrapping="Wrap" Style="{StaticResource PhoneTextNormalStyle}"/>
                                <TextBlock Text="{Binding DistanceInMeters, Mode=TwoWay}" Style="{StaticResource PhoneTextNormalStyle}"/>
                                <Rectangle Fill="Yellow"></Rectangle>
                        </StackPanel>
                        <Image x:Name="img_DealImage" VerticalAlignment="Stretch"></Image>
                        <TextBlock x:Name="tb_ExpiryCountdown" Visibility="Collapsed" Style="{StaticResource PhoneTextNormalStyle}"/>
                        <StackPanel x:Name="sp_ActiveBusiness" Margin="0,10,0,0">
                            <TextBlock Text="{Binding Name, Mode=TwoWay}" Style="{StaticResource PhoneTextNormalStyle}"/>
                            <TextBlock Text="{Binding StreetAddress, Mode=TwoWay}" Style="{StaticResource PhoneTextNormalStyle}"/>
                            <TextBlock Text="{Binding CityStateZip, Mode=TwoWay}" Style="{StaticResource PhoneTextNormalStyle}"/>
                        </StackPanel>
                        <StackPanel x:Name="sp_Buttons" Orientation="Horizontal" Margin="0,0,0,0">
                                <Button x:Name="cb_Share" Content="Share"/>
                                <Button x:Name="cb_AlertMe" Content="I'm Coming" />
                        </StackPanel>
                    </StackPanel>
                </Grid>

            </controls:PivotItem>
            <controls:PivotItem Header="map">
                <Grid>
                    <!--
                    <Grid.RowDefinitions>
                        <RowDefinition Height="91" />
                        <RowDefinition Height="467" />
                        <RowDefinition Height="36" />
                    </Grid.RowDefinitions> -->
                    <StackPanel VerticalAlignment="Stretch" Margin="0" >
                        <TextBlock x:Name="tb_TitleBusinessName" HorizontalAlignment="Left"  Text="dd" Style="{StaticResource PhoneTextLargeStyle}"/>
                        <TextBlock x:Name="tb_TitleBusinessAddress" HorizontalAlignment="Left" Text="" Style="{StaticResource PhoneTextNormalStyle}"/>
                        <TextBlock x:Name="tb_TitleBusinessCityStateZip" HorizontalAlignment="Left" Text="" Style="{StaticResource PhoneTextNormalStyle}"/>
                        <TextBlock x:Name="tb_TitleBusinessPhone" HorizontalAlignment="Left" Text="" Style="{StaticResource PhoneTextNormalStyle}"/>
                    
                        <m:Map x:Name="DealMap"  VerticalAlignment="Stretch"  CredentialsProvider="AhjnioLJ0hUMKiqsRLUBKixF_uNXULXCtGG_1uHOoMIIJ19wtqF2T6puydIRWUw1" Margin="0,68,0,0" />
                    <TextBlock x:Name="tb_Distance" Text="ffff" Style="{StaticResource PhoneTextNormalStyle}" HorizontalAlignment="Left" Canvas.ZIndex="1" Margin="12,10,12,0"  />
                    </StackPanel>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="nearby" >
                <Grid>
                    <StackPanel VerticalAlignment="Stretch" Orientation="Vertical">
                        <TextBlock x:Name="tb_NearbyDealZones" Text="Deals Near You" Style="{StaticResource PhoneTextLargeStyle}" TextWrapping="Wrap"/>
                        <m:Map x:Name="DealZones"  VerticalAlignment="Stretch" CredentialsProvider="AhjnioLJ0hUMKiqsRLUBKixF_uNXULXCtGG_1uHOoMIIJ19wtqF2T6puydIRWUw1" Margin="0,40,0,0" Height="484">
                            <m:MapItemsControl x:Name="mit_DealZones">
                                <m:MapItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <m:Pushpin Location="{Binding Location}">
                                            <StackPanel Orientation="Vertical" Margin="0,10,0,0">
                                                <TextBlock Text="{Binding Title}" FontWeight="Bold" Style="{StaticResource PhoneTextNormalStyle}"/>
                                               
                                                    <TextBlock Text="{Binding BusinessName}" HorizontalAlignment="Left" />
                                                    <TextBlock Text="{Binding ExpiresIn, Mode=TwoWay}" HorizontalAlignment="Right" />
                                              
                                            </StackPanel>
                                        </m:Pushpin>
                                    </DataTemplate>
                                </m:MapItemsControl.ItemTemplate>


                            </m:MapItemsControl>
                        
                        </m:Map>

                        <!-- <ListBox x:Name="lb_ActiveDealList" SelectionChanged="lb_ActiveDealList_SelectionChanged" >
                               <ListBox.ItemTemplate >                                 
                                    <DataTemplate>
                                        <Grid>
                                        <StackPanel Orientation="Vertical" Margin="0,10,0,0">
                                            <TextBlock Text="{Binding Title}" FontWeight="Bold" Style="{StaticResource PhoneTextNormalStyle}"/>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="{Binding BusinessName}" HorizontalAlignment="Left" Style="{StaticResource PhoneTextNormalStyle}"/>
                                                <TextBlock Text="{Binding ExpiresIn, Mode=TwoWay}" HorizontalAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}" Margin="0" />
                                            </StackPanel>
                                        </StackPanel> 
                                        </Grid>    
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>-->
                        
                    </StackPanel>
                </Grid>
            </controls:PivotItem>


            </controls:Pivot>
    </Grid>

    <!--Panorama-based applications should not show an ApplicationBar-->

</phone:PhoneApplicationPage>